#coding:utf-8
import numpy as py
#生成单位矩阵
A = py.eye(5)
print A


import pandas as pd
data = pd.read_csv("ex1data1.txt")
#dataframe转ndarray
arr=data.values
X=arr[:,0]
Y=arr[:,1]
m=arr.size
#在ipython下自动引入了包，否则引入matplotlib
plot(X,Y,'rx')
ylabel('profit in $10,000s')

X2 = np.array([np.ones(m), arr[:,1]]).T
Y=Y.reshape(m,1)
theta=np.zeros(2).reshape((2,1))
iterations=1500
alpha=0.01